Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MINOR: remove ZK from code base #529

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

MINOR: remove ZK from code base #529

wants to merge 8 commits into from

Conversation

mjsax
Copy link
Member

@mjsax mjsax commented Dec 17, 2024

No description provided.

@mjsax mjsax requested a review from a team as a code owner December 17, 2024 04:56
@sonarqube-confluent

This comment has been minimized.

@@ -241,6 +238,12 @@
<classifier>test</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-test-common</artifactId>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To pull in KafkaClusterTestKit.

<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>4.0.1</version>
</dependency>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W/o this, I got some ClassNotFoundException error -- just Googled for the error and found to add this... 🤷

producer.send(new ProducerRecord<>(WikipediaFeedAvroExample.WIKIPEDIA_FEED,
new WikiFeed("john", true, "first post")));
producer.flush();
try (final KafkaProducer<String, WikiFeed> producer = new KafkaProducer<>(props)) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side cleanup to close the producer properly.

final Map<String, String> effectiveBrokerConfig = effectiveBrokerConfigFrom(brokerConfig);
log.debug(
"Starting a Kafka instance on port {} ...",
effectiveBrokerConfig.get(SocketServerConfigs.LISTENERS_CONFIG)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that we don't configure this explicitly any longer, I am not 100% if this is still right?

effectiveConfig.putAll(brokerConfig);
effectiveConfig.put(ZkConfigs.ZK_CONNECT_CONFIG, zookeeper.connectString());
effectiveConfig.put(ZkConfigs.ZK_SESSION_TIMEOUT_MS_CONFIG, 30 * 1000);
effectiveConfig.put(SocketServerConfigs.LISTENERS_CONFIG, String.format("PLAINTEXT://127.0.0.1:%s", DEFAULT_BROKER_PORT));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed to remove this -- otherwise, I got some config errors about other missing config... not sure why this was set to begin with? Did not want to go down the rabbit whole figuring out all other required/dependent configs to keep it (also not sure why it did work with the old setup, but not the new one... 🤷)

} catch (final Exception fatal) {
throw new RuntimeException(fatal);
if (schemaRegistry != null) {
schemaRegistry.stop();
}
if (broker != null) {
broker.stop();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this throws now, so changed the try-catch to also handle it.

@@ -267,16 +253,14 @@ private TopicsDeletedCondition(final String... topics) {

@Override
public boolean conditionMet() {
//TODO once KAFKA-6098 is fixed use AdminClient to verify topics have been deleted
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not fixed yet... but was simplest to just use Admin client now...

private Properties effectiveConfigFrom(final Properties initialConfig) {
final Properties effectiveConfig = new Properties();
effectiveConfig.put(ServerConfigs.BROKER_ID_CONFIG, 0);
effectiveConfig.put(SocketServerConfigs.LISTENERS_CONFIG, "PLAINTEXT://127.0.0.1:9092");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above. Removed this one.

@sonarqube-confluent
Copy link

Passed

Analysis Details

2 Issues

  • Bug 2 Bugs
  • Vulnerability 0 Vulnerabilities
  • Code Smell 0 Code Smells

Coverage and Duplications

  • Coverage No coverage information (0.00% Estimated after merge)
  • Duplications No duplication information (47.20% Estimated after merge)

Project ID: kafka-streams-examples

View in SonarQube

@@ -24,7 +24,7 @@ global_job_config:
prologue:
commands:
- checkout
- sem-version java 11
- sem-version java 17
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temp fix as ae49f5f did not make it into master yet.

\cc @hk10111 -- hope we can resolve the merge conflicts soon... Or merging this PR will create more conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant